package com.zcx.mall.oauth.service;

import com.zcx.mall.oauth.entity.SysUser;
import org.bouncycastle.util.encoders.Base64;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.stereotype.Service;

/**
 * @author: zhangcx
 * @create: 2021-01-12 16:21
 **/
@Service
public class SysUserService {

    /**
     *  根据用户名查询用户
     * @param username
     * @return com.zcx.mall.oauth.entity.SysUser
     */
    public SysUser selectByUsername(String username) {
        return new SysUser("1","yaohw","$2a$10$CwIutywnbs9bifHaY3Ezu.gYkWi4Zano8gVPq08hXjal6.uj.Yzuy","测试字段，根据用户名查询");
    }

    /**
     * 根据手机号查询用户
     * @param mobile
     * @return com.zcx.mall.oauth.entity.SysUser
     */
    public SysUser selectByMobile(String mobile) {
        return new SysUser("2","yaohw2","$2a$10$CwIutywnbs9bifHaY3Ezu.gYkWi4Zano8gVPq08hXjal6.uj.Yzuy","测试字段，根据手机号查询");
    }

    public static void main(String[] args) {
        BCryptPasswordEncoder bCryptPasswordEncoder = new BCryptPasswordEncoder();

        String as = bCryptPasswordEncoder.encode("yaohw");
        System.out.println(as);
    }
}
